#ifndef SYSSTRING_H
#define SYSSTRING_H

#pragma warning(disable:4786)
#pragma warning(disable:4251)

#include <vector>
#include <ctype.h>

#include "CommonDefine.h"

#define ERASE_R			0x0001
#define ERASE_N			0x0002
#define ERASE_T			0x0004
#define ERASE_B			0x0008

//#include "LibUtility.h"
//class LIB_UTILITY_DLLAPI CSysString
class CSysString
{
private:
	_tstring m_strMsg;
	long m_lOffset;
	long m_lSize;

public:
	static _tstring ConvertHtmlEntity(const _tstring& strInput, int nType = 1);
	
	static int Parse(const _tstring &strData, const char& cDel, vector<_tstring> &vRes);
	static int ParseA(const string &strData, const char &cDel, vector<string>& vRes);

	static int ParseEx(const _tstring &strData, const char& cDel, vector<_tstring> &vRes, const char& cIgnore=0);
	static int ParseExA(const string &strData, const char& cDel, vector<string> &vRes, const char& cIgnore=0);

	static _tstring Trim(const _tstring&, int nDirect=2);
	static string TrimA(const string&, int nDirect=2);

	static _tstring EraseGarbage(const _tstring& str, int nGarbage=0);
	static string EraseGarbageA(const string &str, int nGarbage=0);

	static _tstring ToCRLF(const _tstring& strMsg);
	static _tstring ToCR(const _tstring& strMsg);
	static _tstring ToLF(const _tstring& strMsg);
	
	static _tstring ToUpper(const _tstring& str);
	static string ToLowerA(const string& str);
	static _tstring ToLower(const _tstring& str);
	static string ToUpperA(const string& str);
	
	static bool _isspaceA(char c);
	static bool _isspaceW(TCHAR c);

	// Non Static Function.....
	bool SetPos(long lOffset);
	long GetCurrentPos();
	int GetLine(_tstring& rstrRes);
	void SetValue(const _tstring& strMsg);
		
	CSysString(const _tstring& strMsg);
	CSysString();
	~CSysString();	
};

#endif // #ifndef SYSSTRING_H

